<template>
  <div>
    <input
      v-model="value"
      type="text"
      placeholder="请输入"
    />
    <button @click="handleAdd">添加</button>
  </div>
</template>
<script setup>
import { ref, defineExpose } from 'vue';
const list = ref(['JavaScript', 'HTML', 'CSS']);
const value = ref('');
// add 触发后的事件处理函数
const handleAdd = () => {
  list.value.push(value.value);
  value.value = '';
};

defineExpose({ list });
</script>
